using System;
using Windy.Transformations;
using System.Collections.Generic;
using System.ComponentModel.Composition;

namespace Windy.DragonCurve.Models.Schemes
{
    /// <summary>
    /// Lévy Dragon
    ///
    /// Variables:	F
    /// Constants:	+ -
    /// Start:	F
    /// Rules:	F → +F--F+
    /// where "F" means "draw forward", "+" means "turn clockwise 45°", and "?" means "turn anticlockwise 45°".
    /// </summary>
    [Export(typeof(DragonCurveScheme))]
    public class LevyDragonScheme : DragonCurveScheme
    {
        public LevyDragonScheme()
        {
            this.SetupName("Lévy Dragon")
                .SetupInitialSymbols(Symbols.F)
                .SetupCurveRules
                (
                    new ReplaceTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.Plus, Symbols.Plus),
                    new ReplaceTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.Minus, Symbols.Minus),

                    new ExpandTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.F,
                            Symbols.Plus, Symbols.F, Symbols.Minus, Symbols.Minus, Symbols.F, Symbols.Plus)
                )
                .SetupPlotRules(DragonCurvePlotRules.IngnoreVariablePlotingRules)
                .SetupStepAngelDegree(45);
        }
    }
}
